package com.aspose.cells;

abstract class zj implements zafy {
   protected zhh a;
   protected zxz b = new zxz();

   public zj(zhh var1, String var2) {
      this.a = var1;
      if (var2 == null) {
         var2 = var1.a();
      }

      char[] var3 = var2.toCharArray();
      this.a(var3, 0, var3.length);
   }

   public abstract int a();

   protected abstract void a(char[] var1, int var2, int var3);

   public zxz a(zxu var1, Object var2) {
      return this.a(var1, zamo.a(var2.getClass()), var2);
   }

   public double a(double var1) {
      return var1;
   }

   public zxz a(zxu var1, int var2, Object var3) {
      this.b.a();
      if (var2 == 18 && zbtq.a((String)var3)) {
         this.b.a(1, (String)com.aspose.cells.b.a.zr.a(var3));
         return this.b;
      } else {
         if (!com.aspose.cells.a.c.zh.a(this.a.c())) {
            this.b.a(this.a.c());
         }

         return this.b;
      }
   }

   public zhh b() {
      return this.a;
   }

   protected void a(Object var1, int var2, zxz var3) {
      switch(var2) {
      case 3:
         var3.a(1, (String)((Boolean)var1 ? "TRUE" : "FALSE"));
         return;
      default:
         var3.a(1, (String)com.aspose.cells.b.a.zr.a(var1));
      }
   }

   protected DateTime b(double var1) {
      return zbtq.a(var1, this.a.b().c());
   }

   protected double a(DateTime var1) {
      return zbtq.a(var1, this.a.b().c());
   }

   protected void a(zxz var1, zxz var2, int var3) {
      int var4 = var2.j();
      if (var4 > 0) {
         int var5 = var1.j();
         int[] var6 = new int[var5 + var4];
         if (var5 > 0) {
            System.arraycopy(var1.i(), 0, var6, 0, var5);
         }

         var1.a(var6);
         System.arraycopy(var2.i(), 0, var6, var5, var4);

         for(int var7 = 0; var7 < var4; ++var7) {
            var1.a(var5 + var7, var3 + var2.b(var7));
         }
      }

   }

   protected int a(char[] var1, int var2, int var3, StringBuilder var4) {
      switch(var1[var2]) {
      case '"':
         ++var2;

         int var5;
         for(var5 = var2; var2 < var3; ++var2) {
            if (var1[var2] == '"') {
               com.aspose.cells.a.c.zk.a(var4, var1, var5, var2);
               return var2 + 1;
            }
         }

         com.aspose.cells.a.c.zk.a(var4, var1, var5, var2);
         break;
      case '[':
         var2 = this.a.a(var1, var2, var3, var4, true);
         break;
      case '\\':
         ++var2;
         if (var2 < var3) {
            com.aspose.cells.a.c.zk.a(var4, var1[var2]);
            ++var2;
         }
         break;
      default:
         com.aspose.cells.a.c.zk.a(var4, var1[var2]);
         ++var2;
      }

      return var2;
   }

   protected int b(char[] var1, int var2, int var3, StringBuilder var4) {
      return c(var1, var2, var3, var4);
   }

   public static int c(char[] var0, int var1, int var2, StringBuilder var3) {
      switch(var0[var1]) {
      case '"':
         ++var1;
         if (var0[var1] == '"') {
            ++var1;
            break;
         } else {
            var3.append('"');

            while(var1 < var2) {
               var3.append(var0[var1]);
               if (var0[var1] == '"') {
                  ++var1;
                  return var1;
               }

               ++var1;
            }

            return var1;
         }
      case '*':
      case '_':
         var3.append(var0[var1]);
         ++var1;
         if (var1 < var2) {
            var3.append(var0[var1]);
            ++var1;
         }
         break;
      case '[':
         var3.append('[');
         ++var1;

         while(var1 < var2) {
            var3.append(var0[var1]);
            if (var0[var1] == ']') {
               ++var1;
               return var1;
            }

            ++var1;
         }

         return var1;
      case '\\':
         var3.append('\\');
         ++var1;
         if (var1 < var2) {
            var3.append(var0[var1]);
            ++var1;
         }
         break;
      default:
         var3.append(var0[var1]);
         ++var1;
      }

      return var1;
   }

   public static int b(char[] var0, int var1, int var2) {
      switch(var0[var1]) {
      case '"':
         do {
            ++var1;
         } while(var1 < var2 && var0[var1] != '"');

         ++var1;
         break;
      case '*':
      case '\\':
      case '_':
         ++var1;
         if (var1 < var2) {
            ++var1;
         }
         break;
      case '[':
         do {
            ++var1;
         } while(var1 < var2 && var0[var1] != ']');

         ++var1;
         break;
      default:
         ++var1;
      }

      return var1;
   }

   public static boolean a(char[] var0, int var1, int var2, char var3, char var4) {
      boolean var5 = false;

      while(true) {
         while(var1 < var2) {
            switch(var0[var1]) {
            case '"':
               do {
                  ++var1;
               } while(var1 < var2 && var0[var1] != '"');

               ++var1;
               break;
            case '*':
            case '\\':
            case '_':
               ++var1;
               if (var1 < var2) {
                  ++var1;
               }
               break;
            default:
               if (var0[var1] == var3) {
                  var5 = true;
                  var0[var1] = var4;
               }

               ++var1;
            }
         }

         return var5;
      }
   }
}
